package com.ysy.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@AllArgsConstructor
public enum NoteTypeEnum {

    NOTE_IMAGE_TENT(0,"图片"),
    NOTE_VIDEO(1,"视频");

    private final Integer type;
    private final String desc;

    private static final Map<Integer, NoteTypeEnum> cacheMap;

    static {
        cacheMap = Arrays.stream(NoteTypeEnum.values()).collect(Collectors.toMap(NoteTypeEnum::getType, Function.identity()));
    }

    public static NoteTypeEnum getEnum(Integer type) {
      return cacheMap.get(type);
    }
}
